import request from '../utils/requests.js' // 上述封装的js

// get 方式
export const getInfo = (params) => {
  return request({
    url: 'http://61nh21vq7695.vicp.fun/users/login',
    method: 'get',
    params
  })
}

// 登录
export const loginFrom = (data) => {
  return request({
    url: '/users/login',
    method: 'post',
    data
  })
}
// 注册
export const registerFrom = (data) => {
  return request({
    url: '/users/register',
    method: 'post',
    data
  })
}

// 获取所有用户
export const getUserList = (params) => {
  return request({
    url: '/admin/audit',
    method: 'get',
    params
  })
}

// 用户审核
export const setUserApprove = (data) => {
  return request({
    url: '/admin/approve',
    method: 'post',
    data
  })
}

// 获取所有用户
export const getUserListAll = (params) => {
  return request({
    url: '/admin/ApprovedUsers',
    method: 'get',
    params
  })
}
// 用户修改
export const editUserinfo = (data) => {
  return request({
    url:`/admin/user/${data.userId}`,
    method: 'put',
    data
  })
}
// 用户删除
export const delUserinfo = (data) => {
  return request({
    url: '/admin/user',
    method: 'delete',
    data
  })
}
